package com.spogher.components.textfields;

import java.util.Date;

import org.apache.wicket.markup.html.form.TextField;
import org.apache.wicket.markup.html.internal.HtmlHeaderContainer;

public class DatePickerTextField extends TextField<Date>{

	private static final long serialVersionUID = 1L;

	public DatePickerTextField(String id) {
		super(id);
		setOutputMarkupId(true);
		setMarkupId(id);
	}

	@Override
	public void renderHead(HtmlHeaderContainer container) {
		super.renderHead(container);
		String datePickerScript = "$(function() {$( '#" + getId() + "' ).datepicker({ dateFormat: 'dd/mm/yy' });});";
		container.getHeaderResponse().renderJavascript(datePickerScript, getId() + "scriptFunction");
	}
	
	

}
